pellgrant

This exercise will be about creating tables in R and utilizing the DT and gt libraries and their capabilities for visualizations.

Show the code
pell <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2022/2022-08-30/pell.csv')
Show the code
datatable(pell, filter = "top", caption = htmltools::tags$caption(style = "caption-side: bottom; text-align: center;",
    htmltools::strong("Pell Grant provided by Tidy Tuesday")), editable = "cell", extensions = c("Scroller",
    "Buttons"), options = list(deferRender = TRUE, scrollY = 400, scroller = TRUE,
    dom = "Bfrtip", buttons = c("copy", "csv", "excel", "pdf", "print")))
Show the code
t1 <- pell%>%
  head(10)%>%   # Keep only first rows as example
  gt()%>%
  # Add title and subtitle
  tab_header(
    title = "Pell Grant",
    # Use markdown syntax with md()
    subtitle = md("XXX"))%>%
  tab_style(
    # Select object to modify
    locations = cells_title(groups = 'title'),
    # Specify text style
    style = list(
      cell_text(
        font=google_font(name = 'Nunito'), 
        size='xx-large',
        color='darkblue'
  )))
Show the code
t1
Pell Grant
XXX
STATE AWARD RECIPIENT NAME SESSION YEAR
AK 197232.9 109 Alaska Pacific University 1999-00 1999
AK 133148.0 69 Alaska Vocational Technical Center 1999-00 1999
AK 107287.0 72 Sheldon Jackson College 1999-00 1999
AK 3425148.8 1920 University of Alaska - Anchorage 1999-00 1999
AK 2441864.0 1256 University of Alaska at Fairbanks 1999-00 1999
AK 353170.0 221 University of Alaska at Southeast 1999-00 1999
AL 5520921.1 2369 Alabama Agricultural & Mechanical University 1999-00 1999
AL 1548659.2 837 Alabama Southern Community College 1999-00 1999
AL 7164037.3 3236 Alabama State University 1999-00 1999
AL 1514341.0 854 Athens State University 1999-00 1999